package com.health.patient.remote.factory;

import com.health.common.core.domain.R;
import com.health.health.common.dto.PmsConsultationRecordDto;
import com.health.patient.remote.PatientRemoteService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemotePatientFallbackFactory implements FallbackFactory<PatientRemoteService>
{
    private static final Logger log = LoggerFactory.getLogger(RemotePatientFallbackFactory.class);

    @Override
    public PatientRemoteService create(Throwable throwable)
    {
        log.error("科室服务调用失败:{}", throwable.getMessage());
        return new PatientRemoteService()
        {
            @Override
            public R addConsultation(PmsConsultationRecordDto recordDto) {
                return R.fail("调用失败！");
            }
        };
    }
}
